import React from 'react'
import {connect} from '../store'

class ProductList extends React.Component{
    constructor(props){
        super(props)
        this.idRef=React.createRef
        this.nameRef=React.createRef
        this.priceRef=React.createRef
    }
   render(){
       let products=this.props.shop.products
       let pinkProduct=this.props.shop.pinkProduct
       return <div>
         {products.map((item)=>{
             return <div>名称：{item.name},价格：{item.price}
             <button onClick={e=>pinkProduct(item)}>添加购物车</button>
             </div>
         })}
         ID：<input type="text" ref={this.idRef}/>
         NAME:<input type="text" ref={this.nameRef}/>
         PRICE:<input type="text" ref={this.priceRef}/>
         {/* <button onClick={e=>>添加商品</button> */}
       </div>
   }
}

export default connect(ProductList)